<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="webjars/jquery/3.5.1/jquery.js"></script>
<body>

<button onclick="getMag()">获取getMsg</button>

<script>
  function getMag(){
    $.ajax({
      url: "http://localhost:8080/getMag",
      type:"get",
      success: function (data) {
        alert(data)
      }
    })
  }
</script>
</body>
</html>